/**
 * Created by Administrator on 2017/5/8.
 */

var db = require("./db.js");
var grade;


/*==================注册登录=====================================*/
exports.register_lx=function(req,res){
    var selecttxt=req.body.selecttxt,
        user=req.body.user,
        password=req.body.password;
    dealdata(selecttxt);
    db.open_db()
    db.register_data(req,res,selecttxt,user,password,grade)
    db.end_db()
};
function dealdata(da){
    if(da=='管理部'){
        grade='B'
    }else if(da=='后勤部'){
        grade='C'
    }else if(da=='安保部'){
        grade='D'
    }else if(da=='财务部'){
        grade='E'
    }
}
exports.login_lx=function(req,res){
    var selecttxt=req.body.selecttxt,
        user=req.body.user,
        password=req.body.password;
    db.open_db()
    db.login_data(req,res,selecttxt,user,password)
    db.end_db()
};
exports.edit_lx=function(req,res){
    var editpass=req.body.editpass,
        usertext3=req.body.usertext3,
        selecttext3=req.body.selecttext3;

    db.open_db()
    db.edit_data(req,res,editpass,usertext3,selecttext3)
    db.end_db()
};

/*=======================客房管理============================================*/
//客房预订添加
exports.routeTianjia = function(req,res){
    var user=req.body.user,
        tel=req.body.tel,
        order_room=req.body.order_room,
        order_type=req.body.order_type,
        check_in=req.body.check_in,
        check_out=req.body.check_out,
        cash=req.body.cash,
        room_cash=req.body.room_cash,
        remark=req.body.remark,
        order_time=req.body.order_time,
        re_status=req.body.re_status;

    db.open_db();
    db.routeTianjia(user,tel,order_room,order_type,check_in,check_out,cash,room_cash,remark,order_time,re_status,res);
    db.end_db();
};
//预定查询
exports.re_check=function(req,res){
    db.open_db();
    db.re_check_data(req,res);
    db.end_db();
}
exports.add_resver=function(req,res){
    var num=req.body.num
    db.open_db();
    db.add_resver_data(req,res,num);
    db.end_db();
}
exports.cancel_re=function(req,res){
    var r_num=req.body.r_num,
        cancel_stau=req.body.cancel_stau;
    db.open_db();
    db.cancel_re_data(req,res,r_num,cancel_stau);
    db.end_db();
}

exports.cancel_re_no=function(req,res){
    var cancel_stau_no=req.body.cancel_stau_no;
    var cancel_arry=req.body.cancel_arry;
    var rry='';
    var sql="";
      for(var i=0;i<cancel_arry.length;i++){
     if(i==cancel_arry.length-1){
         rry+=cancel_arry[i];
     }else{
         rry+=cancel_arry[i]+",";
     }
     }
  /*  rry=cancel_arry.join(",")*/
    console.log(rry)
    sql="UPDATE reserve SET re_status ='预订失效' WHERE re_roomnuber in ("+rry+");"
    db.open_db();
    db.cancel_re_data_no(req,res,sql);
    db.end_db();
}




//客户查询
exports.routeselect = function(req,res){
    var inp_1=req.body.room1;

    db.open_db();
    db.routeselect(req,res,inp_1);
    db.end_db()
};
exports.routeselect123 = function(req,res){
    var inp_1=req.body.room1;

    db.open_db();
    db.routeselect123_1(req,res,inp_1);
    db.end_db()
};

//  退房用户查询

//按房间号查
exports.retuifang=function(req,res){
    var chafan=req.body.chafan;
    db.open_db();
    db.chafan_table(chafan,res);
    db.end_db();
};
exports.re_tuifang_wq=function(req,res){
    var chafan=req.body.chafan,
        wq_status=req.body.wq_status,
        room_xiaofei=req.body.room_xiaofei;
    db.open_db();
    db.chafan_table_wq(chafan,wq_status,room_xiaofei,res);
    db.end_db();
};
//按姓名查
exports.retuifang2=function(req,res){
    var chafan2=req.body.chafan2;
    db.open_db();
    db.chafan_table2(chafan2,res);
    db.end_db();
};
//============廖聪===========
//房间号查询
exports.cxnumber_lc = function(req,res){
    var myid=req.body.mylc_id;
    db.open_db();
    db.cxnumber_lc(myid,res);
    db.end_db()
};
//姓名查询
exports.cxname_lc = function(req,res){
    var myid=req.body.mylc_id;
    db.open_db();
    db.cxname_lc(myid,res);
    db.end_db()
};
//房间调整
exports.lc_addmodify = function(req,res){
    var val1=req.body.lc_val1;
    var val2=req.body.lc_val2;
    var val3=req.body.lc_val3;
    var val4=req.body.lc_val4;
    var val5=req.body.lc_val5;

    db.open_db();
    db.lc_addmodify(val1,val3,val2,val5,val4,res);
    db.end_db()
};
//时间调整
exports.lc_modifytime = function(req,res){
    var val1=req.body.lc_val1;
    var val2=req.body.lc_val2;
    db.open_db();
    db.lc_modifytime(val2,val1,res);
    db.end_db();
};


/*===================住宿登记======================================*/

//入住登记
exports.routeText = function(req,res){
    var test1 = req.body.test1,
        test2 = req.body.test2,
        test3 = req.body.test3,
        test4 = req.body.test4,
        test5 = req.body.test5,
        test6= req.body.test6,
        test7= req.body.test7,
        test8= req.body.test8,
        test9= req.body.test9,
        test10= req.body.test10,
        test11= req.body.test11,
        test12= req.body.test12,
        test13= req.body.test13,
        test14= req.body.test14,
        test15= req.body.test15,
        test16= req.body.test16,
        test17= req.body.test17,
        acc_status=req.body.acc_status;
    db.open_db();
    db.routeText(test1,test2,test3,test4,test5,test6,test7,test8,test9,test10,test11,test12,test13,test14,test15,test16,test17,acc_status,res);
    db.end_db();
}

exports.re_check_zhusu=function(req,res){
    db.open_db();
    db.re_check_zhusu_data(req,res);
    db.end_db();
}
exports.add_zhusuadd=function(req,res){
    var num=req.body.num
    db.open_db();
    db.re_check_zhusuadd_data(num,req,res);
    db.end_db();
};

exports.cancel_room_lx=function(req,res){
    var r_num=req.body.r_num,
        cancel_stau=req.body.cancel_stau;
    db.open_db();
    db.cancel_re_room_data(req,res,r_num,cancel_stau);
    db.end_db();
}

/*=================客户信息==================================*/
/*==============查询数据库=========================*/
exports.CustomerPost=function(req,res){

    db.open_db();
    db.information(req,res);
    db.end_db()
};

//删除数据
exports.DeletePost = function(req,res){
    var shang=req.body.shang;
    db.open_db();
    db.Delete_table(shang,res);
    db.end_db()
};

//日期查询
exports.riqichaPost = function(req,res){
    var kaishit = req.body.kaishi;
    var jieshu = req.body.jieshu;
    db.open_db();
    db.riqicha(kaishit,jieshu,res);
    db.end_db();
};

//修改信息
//修改姓名
exports.xinminPost = function(req,res){
    var num=req.body.num;
    var xinmin=req.body.xinmin;
    db.open_db();
    db.xinmin_table(xinmin,num,res);
    db.end_db();
};
//修改性别
exports.xinbiePost = function(req,res){
    var num=req.body.num;
    var xinbie=req.body.xinbie;
    db.open_db();
    db.xinbie_table(xinbie,num,res);
    db.end_db();
};
//修改入住时间
exports.rzsjPost = function(req,res){
    var num=req.body.num;
    var rzsj=req.body.rzsj;
    db.open_db();
    db.rzsj_table(rzsj,num,res);
    db.end_db();
};
//修改退房时间
exports.tfsjPost = function(req,res){
    var num=req.body.num;
    var tfsj=req.body.tfsj;
    db.open_db();
    db.tfsj_table(tfsj,num,res);
    db.end_db();
};
//修改证件号码
exports.zjhmPost = function(req,res){
    var num=req.body.num;
    var zjhm=req.body.zjhm;
    db.open_db();
    db.zjhm_table(zjhm,num,res);
    db.end_db();
};
//修改所住房间
exports.szfjPost = function(req,res){
    var num=req.body.num;
    var szfj=req.body.szfj;
    db.open_db();
    db.szfj_table(szfj,num,res);
    db.end_db();
};
//修改消费金额
exports.xfjeePost = function(req,res){
    var num=req.body.num;
    var xfjee=req.body.xfjee;
    db.open_db();
    db.xfjee_table(xfjee,num,res);
    db.end_db();
};
//修改房间费
exports.xfjePost = function(req,res){
    var num=req.body.num;
    var xfje=req.body.xfje;
    db.open_db();
    db.xfje_table(xfje,num,res);
    db.end_db();
};
//修改所交押金
exports.sjyjPost = function(req,res){
    var num=req.body.num;
    var sjyj=req.body.sjyj;
    db.open_db();
    db.sjyj_table(sjyj,num,res);
    db.end_db();
};
//修改入住类型
exports.szlxPost = function(req,res){
    var num=req.body.num;
    var szlx=req.body.szlx;
    db.open_db();
    db.szlx_table(szlx,num,res);
    db.end_db();
};
//修改点哈姆
exports.dhhmPost = function(req,res){
    var num=req.body.num;
    var dhhm=req.body.dhhm;
    db.open_db();
    db.dhhm_table(dhhm,num,res);
    db.end_db();
};
//修改入住状态
exports.dhhmoPost = function(req,res){
    var num=req.body.num;
    var dhhmo=req.body.dhhmo;
    db.open_db();
    db.dhhmo_table(dhhmo,num,res);
    db.end_db();
};
//修改全部
exports.xiugaiPost = function(req,res){

    var num=req.body.num;
    var xinmin=req.body.xinmin;
    var xinbie=req.body.xinbie;
    var rzsj=req.body.rzsj;
    var tfsj=req.body.tfsj;
    var zjhm=req.body.zjhm;
    var szfj=req.body.szfj;
    var xfje=req.body.xfje;
    var sjyj=req.body.sjyj;
    var szlx=req.body.szlx;
    var szlxo=req.body.szlxo;
    var dhhm=req.body.dhhm;
    var dhhmo=req.body.dhhmo;
    console.log(num)
    db.open_db();
    db.xiugaiPost_table(xinmin,xinbie,rzsj,tfsj,zjhm,szfj,xfje,sjyj,szlx,szlxo,dhhm,num,dhhmo,res);
    db.end_db();
};

//模糊查询
exports.chaxunPost=function(req,res){
    var chaxun=req.body.mhmin;

    db.open_db();
    db.chaxun_table(chaxun,res);
    db.end_db();
}


//===============lc==============


//=================管理人员
exports.p_addStaff_lc=function(req,res){
    //console.log(req.body);
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_state=req.body.inp8,
        a_bonus= 0,
        a_attendance=1;
    console.log(a_starttime);
    db.open_db();
    db.p_addStaff_lc(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_state,a_bonus,a_attendance,res);
    db.end_db();
};

//分页
exports.lc_page=function(req,res){
    var page=req.body.page;

    db.open_db();
    db.lc_page((page-1)*8,res);
    db.end_db();
};

//总页数
exports.lc_pagenum=function(req,res){
    //var page=req.body.page;
    //console.log(123);
    db.open_db();
    db.lc_pagenum(req,res);
    db.end_db();
};

//查询信息
exports.lc_id=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_id(lc_id,res);
    db.end_db();
};
exports.lc_id1=function(req,res){
    var lc_id=req.body.myid;
    var lc_id1=req.body.myid;

    db.open_db();
    db.lc_id1(lc_id,lc_id1,res);
    db.end_db();
};
//工号查询
exports.lc_number1=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_number1(lc_id,res);
    db.end_db();
};
exports.lc_name1=function(req,res){
    var lc_id=req.body.myid;
    lc_id='%'+lc_id+'%';
    db.open_db();
    db.lc_name1(lc_id,res);
    db.end_db();
};

//修改信息
exports.p_modify_lc=function(req,res){
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_bonus= req.body.inp8,
        a_state=req.body.inp9,
        a_attendance= 1,
        lc_id=req.body.lc_id;
    console.log(lc_id)
    db.open_db();
    db.p_modify_lc(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_bonus,a_state,
        a_attendance,lc_id,res);
    db.end_db();
};


//==========================后勤人员
exports.l_addStaff_lc=function(req,res){
    //console.log(req.body);
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_state=req.body.inp8,
        a_bonus= 0,
        a_attendance=1;
    console.log(a_starttime);
    db.open_db();
    db.l_addStaff_lc(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_state,a_bonus,a_attendance,res);
    db.end_db();
};

//分页
exports.lc_page_l=function(req,res){
    var page=req.body.page;

    db.open_db();
    db.lc_page_l((page-1)*8,res);
    db.end_db();
};

//总页数
exports.lc_pagenum_l=function(req,res){
    //var page=req.body.page;
    //console.log(123);
    db.open_db();
    db.lc_pagenum_l(req,res);
    db.end_db();
};

//查询信息
exports.lc_id_l=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_id_l(lc_id,res);
    db.end_db();
};
exports.lc_id1_l=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_id1_l(lc_id,res);
    db.end_db();
};
//工号查询
exports.lc_number1_l=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_number1_l(lc_id,res);
    db.end_db();
};
exports.lc_name1_l=function(req,res){
    var lc_id=req.body.myid;
    lc_id='%'+lc_id+'%';
    db.open_db();
    db.lc_name1_l(lc_id,res);
    db.end_db();
};

//修改信息
exports.p_modify_lc_l=function(req,res){
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_bonus= req.body.inp8,
        a_state=req.body.inp9,
        a_attendance= 1,
        lc_id=req.body.lc_id;
    console.log(lc_id)
    db.open_db();
    db.p_modify_lc_l(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_bonus,a_state,
        a_attendance,lc_id,res);
    db.end_db();
};

//===========安保人员
exports.s_addStaff_lc=function(req,res){
    //console.log(req.body);
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_state=req.body.inp8,
        a_bonus= 0,
        a_attendance=1;
    console.log(a_starttime);
    db.open_db();
    db.s_addStaff_lc(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_state,a_bonus,a_attendance,res);
    db.end_db();
};

//分页
exports.lc_page_s=function(req,res){
    var page=req.body.page;

    db.open_db();
    db.lc_page_s((page-1)*8,res);
    db.end_db();
};

//总页数
exports.lc_pagenum_s=function(req,res){
    db.open_db();
    db.lc_pagenum_s(req,res);
    db.end_db();
};

//查询信息
exports.lc_id_s=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_id_s(lc_id,res);
    db.end_db();
};
exports.lc_id1_s=function(req,res){
    var lc_id=req.body.myid;
    var lc_id1=req.body.myid;

    db.open_db();
    db.lc_id1_s(lc_id,lc_id1,res);
    db.end_db();
};
//工号查询
exports.lc_number1_s=function(req,res){
    var lc_id=req.body.myid;
    db.open_db();
    db.lc_number1_s(lc_id,res);
    db.end_db();
};
exports.lc_name1_s=function(req,res){
    var lc_id=req.body.myid;
    lc_id='%'+lc_id+'%';
    db.open_db();
    db.lc_name1_s(lc_id,res);
    db.end_db();
};

//修改信息
exports.p_modify_lc_s=function(req,res){
    var a_name=req.body.inp1,
        a_position=req.body.inp2,
        a_tel=req.body.inp3,
        a_address=req.body.inp4,
        a_sex=req.body.inp5,
        a_starttime=req.body.inp6,
        a_money=req.body.inp7,
        a_bonus= req.body.inp8,
        a_state=req.body.inp9,
        a_attendance= 1,
        lc_id=req.body.lc_id;
    console.log(lc_id)
    db.open_db();
    db.p_modify_lc_s(a_name,a_position,a_tel,a_address,a_sex,a_starttime,a_money,a_bonus,a_state,
        a_attendance,lc_id,res);
    db.end_db();
};
//===============lc==============


//====================gl==============
//列表日志
exports.journal = function(req,res) {
    var page = req.body.page;
    db.open_db();
    db.db_journal(page, res);
    db.end_db();
}
//按时间查询
exports.journal_1 = function(req,res) {
    var in_1 = req.body.in_1;
    db.open_db();
    db.db_journal_1(in_1, res);
    db.end_db();
}
//按姓名查询
exports.journal_2 = function(req,res) {
    var in_2 = req.body.in_2;
    db.open_db();
    db.db_journal_2(in_2, res);
    db.end_db();
}
//按工号查询
exports.journal_3 = function(req,res) {
    var in_3 = req.body.in_3;
    db.open_db();
    db.db_journal_3(in_3, res);
    db.end_db();
}
//添加新信息
exports.append1 = function(req,res) {
    var inpu_1 = req.body.inpu_1;
    var inpu_2 = req.body.inpu_2;
    var inpu_3 = req.body.inpu_3;
    var inpu_4 = req.body.inpu_4;
    db.open_db();
    db.db_addend1(inpu_1,inpu_2,inpu_3,inpu_4,res);
    db.end_db();
}

//修改信息 页面
//1.第一时间所看到的
exports.modify1 =function(req,res){
    var s_name =req.body.s_name;
    db.open_db();
    db.db_modify1(s_name,res);
    db.end_db();
}
//修改信息 页面
//2.点击提交按钮之后
exports.modify2 =function(req,res){
    var s_name =req.body.s_name;
    var inp_1=req.body.inp_1,
        inp_2=req.body.inp_2,
        inp_3=req.body.inp_3,
        inp_4=req.body.inp_4
    db.open_db();
    db.db_modify2(inp_1,inp_2,inp_3,inp_4,s_name,res);
    db.end_db();
}
//删除信息
exports.delete1 =function(req,res){
    var s_name =req.body.s_name;
    db.open_db();
    db.db_delete1(s_name,res);
    db.end_db();
}

//1.总收入
//客户费用表消费
exports.y_income = function(req,res) {
    db.open_db();
    db.db_y_income(req, res);
    db.end_db();
}
//1月月收入
exports.y_income1 = function(req,res) {
    db.open_db();
    db.db_y_income1(req, res);
    db.end_db();
}
//2月月收入
exports.y_income2 = function(req,res) {
    db.open_db();
    db.db_y_income2(req, res);
    db.end_db();
}
//3月月收入
exports.y_income3 = function(req,res) {
    db.open_db();
    db.db_y_income3(req, res);
    db.end_db();
}
//4月月收入
exports.y_income4 = function(req,res) {
    db.open_db();
    db.db_y_income4(req, res);
    db.end_db();
}
//5月月收入
exports.y_income5 = function(req,res) {
    db.open_db();
    db.db_y_income5(req, res);
    db.end_db();
}
//6月月收入
exports.y_income6 = function(req,res) {
    db.open_db();
    db.db_y_income6(req, res);
    db.end_db();
}
//7月月收入
exports.y_income7 = function(req,res) {
    db.open_db();
    db.db_y_income7(req, res);
    db.end_db();
}
//8月月收入
exports.y_income8 = function(req,res) {
    db.open_db();
    db.db_y_income8(req, res);
    db.end_db();
}
//9月月收入
exports.y_income9 = function(req,res) {
    db.open_db();
    db.db_y_income9(req, res);
    db.end_db();
}
//10月月收入
exports.y_income10 = function(req,res) {
    db.open_db();
    db.db_y_income10(req, res);
    db.end_db();
}
//11月月收入
exports.y_income11 = function(req,res) {
    db.open_db();
    db.db_y_income11(req, res);
    db.end_db();
}
//12月月收入
exports.y_income12 = function(req,res) {
    db.open_db();
    db.db_y_income12(req, res);
    db.end_db();
}







//2.总支出
exports.y_expenditure = function(req,res) {
    db.open_db();
    db.db_y_expenditure(req, res);
    db.end_db();
}
//1月支出
exports.y_expenditure1 = function(req,res) {
    db.open_db();
    db.db_y_expenditure1(req, res);
    db.end_db();
}
//2月支出
exports.y_expenditure2 = function(req,res) {
    db.open_db();
    db.db_y_expenditure2(req, res);
    db.end_db();
}
//3月支出
exports.y_expenditure3 = function(req,res) {
    db.open_db();
    db.db_y_expenditure3(req, res);
    db.end_db();
}
//4月支出
exports.y_expenditure4 = function(req,res) {
    db.open_db();
    db.db_y_expenditure4(req, res);
    db.end_db();
}
//5月支出
exports.y_expenditure5 = function(req,res) {
    db.open_db();
    db.db_y_expenditure5(req, res);
    db.end_db();
}
//6月支出
exports.y_expenditure6 = function(req,res) {
    db.open_db();
    db.db_y_expenditure6(req, res);
    db.end_db();
}
//7月支出
exports.y_expenditure7 = function(req,res) {
    db.open_db();
    db.db_y_expenditure7(req, res);
    db.end_db();
}
//8月支出
exports.y_expenditure8 = function(req,res) {
    db.open_db();
    db.db_y_expenditure8(req, res);
    db.end_db();
}
//9月支出
exports.y_expenditure9 = function(req,res) {
    db.open_db();
    db.db_y_expenditure9(req, res);
    db.end_db();
}
//10月支出
exports.y_expenditure10 = function(req,res) {
    db.open_db();
    db.db_y_expenditure10(req, res);
    db.end_db();
}
//11月支出
exports.y_expenditure11 = function(req,res) {
    db.open_db();
    db.db_y_expenditure11(req, res);
    db.end_db();
}
//12月支出
exports.y_expenditure12 = function(req,res) {
    db.open_db();
    db.db_y_expenditure12(req, res);
    db.end_db();
}

//=======================gl====================

//==========================陈红=======================================
//维修--------------------------------------------
//加载
exports.jzszChSend=function(req,res){
    db.open_db();
    db.jzszCh_db(req,res);
    db.end_db();
};
//增加
exports.zjszChsend=function(req,res){

    db.open_db();
    db.zjszCh_db(req,res);
    db.end_db();
};
//删除
exports.scszChsend=function(req,res){
    db.open_db();
    db.scszCh_db(req,res);
    db.end_db();
};
//修改
exports.xgszChsend=function(req,res){
    db.open_db();
    db.xgszCh_db(req,res);
    db.end_db();
};
exports.wxszChsend=function(req,res){
    db.open_db();
    db.wxszCh_db(req,res);
    db.end_db();
};
//指派工作--------------------------------------------
exports.zpgzChsend=function(req,res){
    db.open_db();
    db.zpgzCh_db(req,res);
    db.end_db();

};
exports.scwiChsend=function(req,res){
    db.open_db();
    db.scwiCh_db(req,res);
    db.end_db();
};
exports.wwwChsend=function(req,res){
    db.open_db();
    db.wwwCh_db(req,res);
    db.end_db();
};
exports.www1Chsend=function(req,res){
    db.open_db();
    db.www1Ch_db(req,res);
    db.end_db();
};
exports.xsChsend=function(req,res){
    db.open_db();
    db.xsCh_db(req,res);
    db.end_db();
};
//清洁----------------------------------------------------------------
//加载
exports.jzszChSend1=function(req,res){

    db.open_db();
    db.jzszCh1_db(req,res);
    db.end_db();
};
//增加
exports.zjszChsend1=function(req,res){
    db.open_db();
    db.zjszCh1_db(req,res);
    db.end_db();
};
//删除
exports.scszChsend1=function(req,res){
    db.open_db();
    db.scszCh1_db(req,res);
    db.end_db();
};
//修改
exports.xgszChsend1=function(req,res){
    db.open_db();
    db.xgszCh1_db(req,res);
    db.end_db();
};
exports.wxszChsend1=function(req,res){
    db.open_db();
    db.wxszCh1_db(req,res);
    db.end_db();
};
//指派工作--------------------------------------------
exports.zpgzChsend1=function(req,res){
    db.open_db();
    db.zpgzCh1_db(req,res);
    db.end_db();

};
exports.scwiChsend1=function(req,res){
    db.open_db();
    db.scwiCh1_db(req,res);
    db.end_db();
};
exports.wwwChsend1=function(req,res){
    db.open_db();
    db.wwwCh1_db(req,res);
    db.end_db();
};
exports.www1Chsend1=function(req,res){
    db.open_db();
    db.www1Ch1_db(req,res);
    db.end_db();
};
exports.xsChsend1=function(req,res){
    db.open_db();
    db.xsCh1_db(req,res);
    db.end_db();

};
//-----------------------------------------------------------------------------